feat(login): derive the managed API URL - #371
Merged
Merged
Conversation
Use the live data-plane hostname already returned by the token host when --api-url is absent. Refuse not-yet-live or missing hostnames without writing credentials, while preserving the explicit override for self-hosted and local deployments.
fazpu
force-pushed
the
feat/device-login-hostname
branch
from
September 3, 2026 18:01
7750635 to
1c96c44
Compare
Normalize and reject malformed managed hostnames, accept nullable readiness from the separately deployed token service, and preserve predecessor credentials on refusal. Document why only an explicit API URL overrides the credential-bound hostname.
Validate the advertised endpoint as a real DNS or IP authority, quote it in errors, and warn when an environment URL will override the stored endpoint. Complete the token response design and prove refusal revokes the new bearer.
Guard httpx's lazy IDNA decoding so every malformed advertised host becomes a normal adoption refusal and the freshly minted credential is withdrawn. Record all hostname refusal outcomes in the normative recovery table.
Accept underscore labels and one DNS root dot while refusing a second, document the exact authority shape, and tell users how to override an invalid advertised host.
Reject empty-userinfo and trailing-path forms that URL parsing normalizes away, cover both in the refusal suite, and keep the adoption recovery comment exact.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
remember loginalready receives the deployment hostname and its readiness from the token host, but ignored both. Managed users therefore had to pass an API URL the control plane had already supplied.What this does
https://{data_plane_hostname}when--api-urlis absent and the advertised hostname is live--api-urlas the winning self-host/local override--api-urlHow verified
uv run pytest src/tests/surfaces/test_login.py -q— 58 passeduv run lint-importsuv run ruff check src/ benchmarks/uv run ruff format --check src/ benchmarks/uv run pyright src/ benchmarks/Docs
The CLI reference now shows the one-flag managed form, retains the two-flag self-host form, and documents both refusal cases.
Contributor agreement